Python – Split Dictionary values on size limit of values
Given a dictionary with string values, the task is to write a python program to split values if the size of string exceeds K....
read more
Python – Concatenate Ranged Values in String list
Given list of strings, perform concatenation of ranged values from the Strings list....
read more
Python program to Reverse a range in list
Given a List, our task is to write a Python program to reverse a range in the list....
read more
Python Program to replace list elements within a range with a given number
Given a range, the task here  is to write a python program that can update the list elements falling under a given index range with a specified number....
read more
Python | Convert String to list of tuples
Sometimes, while working with data, we can have a problem in which we have a string list of data and we need to convert the same to list of records. This kind of problem can come when we deal with a lot of string data. Let’s discuss certain ways in which this task can be performed....
read more
Python Program for Program to Print Matrix in Z form
Given a square matrix of order n*n, we need to print elements of the matrix in Z form...
read more
Character Encoding Detection With Chardet in Python
We are given some characters in the form of text files, unknown encoded text, and website content and our task is to detect the character encoding with Chardet in Python. In this article, we will see how we can perform character encoding detection with Chardet in Python....
read more
File System Manipulation in Python
File system manipulation in Python refers to the ability to perform various operations on files, such as creating, reading, writing, appending, renaming, and deleting. Python provides several built-in modules and functions that allow you to perform various file system operations. Python treats files differently based on whether they are text or binary. Each line of code in a text file includes a sequence of characters, terminated by an End of Line (EOL) character....
read more
PySpark lag() Function
The function that allows the user to query on more than one row of a table returning the previous row in the table is known as lag in Python. Apart from returning the offset value, the lag function also gives us the feature to set the default value in spite of None in the column. The setting of the default value is optional but it proves to b useful numerous times. In this article, we will discuss regarding the same, i.e., setting the default value for pyspark.sql.functions.lag to a value within the current row....
read more
Define a 3 Level Nested Dictionary in Python
In Python, dictionaries provide a versatile way to store and organize data. Nested dictionaries, in particular, allow for the creation of multi-level structures. In this article, we’ll explore the process of defining a 3-level nested dictionary and demonstrate various methods to achieve this....
read more
Python Program For Stock Buy Sell To Maximize Profit
The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all....
read more
Python Program to remove elements that are less than K difference away in a list
Given a list, perform removal of those elements whose difference is less than K from its previous element....
read more